
function deepClone(target, map = []) {
  //console.log(typeof target)
  if(typeof target !== 'object') {
    return target
  }


  let result = Array.isArray(target) ? [] : {}
  console.log('1')
  for (let key in target) {
   if (target.hasOwnProperty(key)) {
     result[key] = deepClone(target[key])
   }
  }
  return result
}

let obj = {
  a: {
    b: 1
  }
}
let cloneObj = deepClone(obj)
